package com.baizhi.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.Date;

@Document(indexName = "menus",type = "menu")
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("menus")
public class Menu {
        @Id
        @Field(type = FieldType.Keyword)
        private String id;

        @Field(type = FieldType.Text,analyzer = "ik_max_word")
        private String name;

        @Field(type = FieldType.Keyword)
        private String photo;

        @Field(type = FieldType.Date)
        @JsonFormat(pattern = "yyyy-MM-dd")
        private Date createDate;

        @Field(type = FieldType.Keyword)
        private String createPerson;

        @Field(type = FieldType.Text,analyzer = "ik_max_word")
        private String digest;

        @Field(type = FieldType.Text,analyzer = "ik_max_word")
        private String step;

        @Override
        public String toString() {
                return "Menu{" +
                        "id='" + id + '\'' +
                        ", name='" + name + '\'' +
                        ", photo='" + photo + '\'' +
                        ", createDate=" + createDate +
                        ", createPerson='" + createPerson + '\'' +
                        ", digest='" + digest + '\'' +
                        ", step='" + step + '\'' +
                        '}';
        }
}
